ARG ARCH="amd64"
ARG OS="linux"
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"


RUN  mkdir -p /alertmanager/{data,cfg,bin,log} && \ 
     chown -R nobody:nogroup /alertmanager

COPY ./bin/amtool  /alertmanager/bin/amtool
COPY ./bin/alertmanager  /alertmanager/bin/alertmanager
COPY ./scripts/start.sh     /alertmanager/bin/start.sh
COPY ./cfg/alertmanager.yml  /alertmanager/cfg/alertmanager.yml

RUN chmod +x /alertmanager/bin/start.sh

USER       nobody
EXPOSE     9093 9094
VOLUME     [ "/alertmanager" ]
WORKDIR    /alertmanager
CMD ["sh" ,"-c", "/alertmanager/bin/start.sh"]